from meiduo_admin.mypakge import *
from users.models import User
from django.contrib.auth.hashers import make_password


class ADMIN___AdminModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = User
        fields = '__all__'

        # extra_kwarg = {
        #     'password':{'write_only':True}
        # }
        extra_kwargs = {
            "password": {"write_only": True}
        }


    def create(self,validated_data):
        validated_data['password'] = make_password(validated_data['password'])
        validated_data['is_staff'] = True
        return super().create(validated_data)
# class ADMIN___AdminSimpleSerializer(serializers.ModelSerializer):
#     class Meta:
#         modle = User
#         fields =